<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_shipprice.*" %>
<%@page import="com.lmpop.trade.ts_area.*" %>
<%@ page import="com.lmpop.trade.tb_commpara.Tb_commparaInfo" %>
<%@page import="java.util.*" %>
<html>
  <head>
    
    <title>运价管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_categoryInfo.js'></script> 
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ts_areaInfo.js'></script>
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
	<script language="javascript" type="text/javascript" src="shipprice.js"></script>
</head>

<body>

  <% 
  String publish_user_id = "";
	if(session.getAttribute("session_user_id")!=null){
		publish_user_id  = session.getAttribute("session_user_id").toString();
	}         
	Tb_commparaInfo tb_commparaInfo = new Tb_commparaInfo();
  	String price_id="";
  	if(request.getParameter("price_id")!=null) price_id = request.getParameter("price_id");
  	Ti_shippriceInfo ti_shippriceInfo = new Ti_shippriceInfo();
  	List list = ti_shippriceInfo.getListByPk(price_id);
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	
  	String cust_id="",state_code="",start_addr="",end_addr="",ship_type="",ship_way="",car_type="",app_weight="",act_weight="",car_long="",goods_type="",season="",send_price="",mileage="",day_num="",start_date="",end_date="",contact="",phone="",cellphone="",msn="",qq="",email="",in_date="",user_id="",remark="";
  	if(map.get("cust_id")!=null) cust_id = map.get("cust_id").toString();
  	if(map.get("state_code")!=null) state_code = map.get("state_code").toString();
  	if(map.get("start_addr")!=null) start_addr = map.get("start_addr").toString();
  	if(map.get("end_addr")!=null) end_addr = map.get("end_addr").toString();
  	if(map.get("ship_type")!=null) ship_type = map.get("ship_type").toString();
  	if(map.get("ship_way")!=null) ship_way = map.get("ship_way").toString();
  	if(map.get("car_type")!=null) car_type = map.get("car_type").toString();
  	if(map.get("app_weight")!=null) app_weight = map.get("app_weight").toString();
  	if(map.get("act_weight")!=null) act_weight = map.get("act_weight").toString();
  	if(map.get("car_long")!=null) car_long = map.get("car_long").toString();
  	if(map.get("goods_type")!=null) goods_type = map.get("goods_type").toString();
  	if(map.get("season")!=null) season = map.get("season").toString();
  	if(map.get("send_price")!=null) send_price = map.get("send_price").toString();
  	if(map.get("mileage")!=null) mileage = map.get("mileage").toString();
  	if(map.get("day_num")!=null) day_num = map.get("day_num").toString();
  	if(map.get("start_date")!=null) start_date = map.get("start_date").toString();
	if(start_date.length() > 10){
		start_date = start_date.substring(0,10);
	}
  	if(map.get("end_date")!=null) end_date = map.get("end_date").toString();
	if(end_date.length() > 10){
		end_date = end_date.substring(0,10);
	}	
  	if(map.get("contact")!=null) contact = map.get("contact").toString();
  	if(map.get("phone")!=null) phone = map.get("phone").toString();
  	if(map.get("cellphone")!=null) cellphone = map.get("cellphone").toString();
  	if(map.get("msn")!=null) msn = map.get("msn").toString();
  	if(map.get("qq")!=null) qq = map.get("qq").toString();
  	if(map.get("email")!=null) email = map.get("email").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
  	if(map.get("remark")!=null) remark = map.get("remark").toString();
	Ts_areaInfo  ts_areaInfo = new Ts_areaInfo();
	Map areaMap = ts_areaInfo.getAreaClass();
	StringBuffer stateareaAttr = new StringBuffer();
	if(!start_addr.equals("")){
	  String areaIds[] = start_addr.split("\\|");	
	  for(String areaId:areaIds){
		 if(areaMap!=null){
			if(areaMap.get(areaId)!=null){
				stateareaAttr.append(areaMap.get(areaId).toString() + " ");
			}                  
		  }
	   }
	}
	
	StringBuffer endareaAttr = new StringBuffer();
	if(!end_addr.equals("")){
	  String areaIds[] = end_addr.split("\\|");	
	  for(String areaId:areaIds){
		 if(areaMap!=null){
			if(areaMap.get(areaId)!=null){
				endareaAttr.append(areaMap.get(areaId).toString() + " ");
			}                  
		  }                 
	   }		    
	}
	String goods_type_select = tb_commparaInfo.getSelectItem("55",goods_type);   	
	String season_select = tb_commparaInfo.getSelectItem("56",season); 
	String ship_type_select = tb_commparaInfo.getSelectItem("57",ship_type); 
	String car_type_select = tb_commparaInfo.getSelectItem("58",car_type); 	
	String ship_way_select = tb_commparaInfo.getSelectItem("59",ship_way); 	

  %>
	
	<h1>更新运价信息</h1>
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	
	
	<form action="/doTradeReg.do" method="post" name="addForm">
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">

			<tr>
				<td colspan="4">
			   &nbsp;&nbsp;<img src="/program/admin/images/infotip.gif" border="0">&nbsp;&nbsp;<span style="font-size:14px;font-weight:bold;">运价基本信息</span>			</td>
		    </tr>		

		<tr>
			<td align="right" width="10%">
				起运地<font color="red">*</font>
			</td>
			<td>
			<div id="areaId1" style="display:block;">
					<font color="#CECECE"><%=stateareaAttr%></font>
					<input type="button" class="button_css"name="Submit3" value="重新选择地区" style="cursor:pointer;" onClick="ChangeAreaStyleS();"/>
			</div>
			<div id="areaId2" style="display:none;">
					<select name="startprovince" id="startprovince" onclick="setCitys(this.value,'start')">
					  <option value="">省份</option> 
					</select>
					<select name="starteparchy_code" id="starteparchy_code" onclick="setAreas(this.value,'start')">
					  <option value="">地级市</option>
					 </select>
					<select name="startcity_code" id="startcity_code" style="display:inline" >
					 <option value="">市、县级市、县</option> 
					</select>
					<input name="start_addr" id="start_addr" value="<%=start_addr%>"  type="hidden" maxlength="30" />			   
					<input name="start_addr_bak" id="start_addr_bak" value="<%=start_addr%>"  type="hidden" maxlength="30" />			   
				</div>
			</td>

			<td align="right" width="10%">
				目的地<font color="red">*</font>
			</td>
			<td><div id="areaId3" style="display:block;">
					<font color="#CECECE"><%=endareaAttr%></font>
					<input type="button" class="button_css"name="Submit3" value="重新选择地区" style="cursor:pointer;" onClick="ChangeAreaStyleE();"/>
			</div>
			<div id="areaId4" style="display:none;">
					<select name="endprovince" id="endprovince" onclick="setCitys(this.value,'end')">
					  <option value="">省份</option> 
					</select>
					<select name="endeparchy_code" id="endeparchy_code" onclick="setAreas(this.value,'end')">
					  <option value="">地级市</option> 
					 </select>
					<select name="endcity_code" id="endcity_code" style="display:inline" >
					 <option value="">市、县级市、县</option> 
					</select>
					<input name="end_addr" id="end_addr" value="<%=end_addr%>"  type="hidden" maxlength="30" />		
					<input name="end_addr_bak" id="end_addr_bak" value="<%=end_addr%>"  type="hidden" maxlength="30" />			   					
				</div></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				运输方式<font color="red">*</font>
			</td>
			<td>
			<select name="ship_type" id="ship_type">
				<option value="">请选择</option>
				<%=ship_type_select%>
			</select>
			</td>

		<!-- 0：整车 1：零担 2：整箱 3：拼箱 -->
			<td align="right" width="10%">
				运输类型<font color="red">*</font>
			</td>
			<td>
			<select name="ship_way" id="ship_way" onchange="ship_way_change(this.value);">
				<option value="">请选择</option>
				<%=ship_way_select%>
				</select>
			</td>
		</tr>
		</table>
		<table id="ship_way_hidden" style="display:none"  width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
		<tr>
			<td align="right" width="10%">
				车型:
			</td>
			<td>
			<select name="car_type" id="car_type">
			<option value="">请选择</option>
			<%=car_type_select%>
			</select>
			</td>

			<td align="right" width="10%">
				核定载重:
			</td>
			<td><input name="app_weight" id="app_weight" value="<%=app_weight%>"  type="text" maxlength="30" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value='';"/>&nbsp;吨</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				实际载重:
			</td>
			<td><input name="act_weight" id="act_weight" type="text" value="<%=act_weight%>" maxlength="30" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value='';"/>&nbsp;吨</td>

			<td align="right" width="10%">
				车长:
			</td>
			<td><input name="car_long" id="car_long" type="text" value="<%=car_long%>" maxlength="30" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value='';"/>&nbsp;米</td>
		</tr>
		</table>
		<table  width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
		<tr>
			<td align="right" width="10%">
				货物类型:
			</td>
			<td>
			<select name="goods_type" id="goods_type">
				<option value="">请选择</option>
				<%=goods_type_select%>
			</select>
			</td>

			<td align="right" width="10%">
				季节:
			</td>
			<td>
			<select name="season" id="season">
				<option value="">请选择</option>
				<%=season_select%>
			</select>
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				运输价格<font color="red">*</font>
			</td>
			<td><input name="send_price" id="send_price" value="<%=send_price%>" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value='';" type="text" maxlength="6" size="6" />&nbsp;元/公里</td>

			<td align="right" width="10%">
				公里数<font color="red">*</font>
			</td>
			<td><input name="mileage" id="mileage"  value="<%=mileage%>" type="text" maxlength="10" size="10" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value='';"/>&nbsp;公里</td>
		</tr>
		
		
		<tr>
			<td align="right" width="10%">
				生效日期:
			</td>
			<td><input name="start_date" id="start_date" value="<%=start_date%>"  size="15" type="text" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'end_date\',{d:1})}',readOnly:true})" style="width:145px" class="Wdate" maxlength="15" value="" /></td>			

			<td align="right" width="10%">
				结束日期:
			</td>
			<td><input name="end_date" id="end_date"   value="<%=end_date%>"  size="15" type="text" onclick="WdatePicker({minDate:'#F{$dp.$D(\'start_date\',{d:1})}',readOnly:true})"style="width:145px" class="Wdate" maxlength="15" value="" /></td>			
		</tr>
		
		<tr>
			<td align="right" width="10%">
				需要天数:
			</td>
			<td colspan="3"><input name="day_num" id="day_num" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value='';"  value="<%=day_num%>" type="text" size="3" maxlength="3"/>&nbsp;天</td>
		</tr>		
	
			<tr>
				<td colspan="4">
			   &nbsp;&nbsp;<img src="/program/admin/images/infotip.gif" border="0">&nbsp;&nbsp;<span style="font-size:14px;font-weight:bold;">联系人基本信息</span>			</td>
		    </tr>		
	
		<tr>
			<td align="right" width="10%">
				联系人<font color="red">*</font>
			</td>
			<td><input name="contact" id="contact"  value="<%=contact%>"  type="text" maxlength="30"/></td>

			<td align="right" width="10%">
				电话:
			</td>
			<td><input name="phone" id="phone" value="<%=phone%>" type="text" maxlength="15"/></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				手机<font color="red">*</font>
			</td>
			<td><input name="cellphone" id="cellphone" value="<%=cellphone%>" type="text" maxlength="15"/></td>

			<td align="right" width="10%">
				MSN:
			</td>
			<td><input name="msn" id="msn" type="text" value="<%=msn%>" maxlength="30"/></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				QQ:
			</td>
			<td><input name="qq" id="qq" type="text" value="<%=qq%>" maxlength="15"/></td>

			<td align="right" width="10%">
				E-mail:
			</td>
			<td><input name="email" id="email" type="text" value="<%=email%>"  maxlength="30"/></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				备注:
			</td>
			<td colspan="3"><input name="remark" id="remark" value="<%=remark%>" type="text" maxlength="30"/></td>
		</tr>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input name="cust_id" id="cust_id" value="<%=cust_id %>" type="hidden" />
				<input name="state_code" id="state_code" value="<%=state_code %>" type="hidden" />
				<input name="user_id" id="user_id" value="<%=publish_user_id %>" type="hidden" />				
				<input type="hidden" name="bpm_id" value="7957" />
	  			<input type="hidden" name="price_id" value="<%=price_id %>" />
				<input type="button" class="buttoncss" name="tradeSub" value="提交" onclick="submitForm();"/>&nbsp;&nbsp;
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onclick="window.location.href='index.jsp';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
<script>
	setstartProvince();
	setendProvince();
</script>